package com.yy.tools.binary
{
	/**
	 * 处理一些二进制算法
	 * @author YY
	 * 
	 */
	public class BinaryTool
	{
		public function BinaryTool()
		{
		}
		
		/**
		 *数字转换成二进制显示 
		 */	
		public static function convertToBinary(numberToConvert:Number):String 
		{  
			var result:String = "";  
			var lsb:Number; 
			const lng :int = 32; 
			for (var i:int = 0; i < lng; i++) 
			{  
				// Extract least significant bit using bitwise AND.  
				lsb = numberToConvert & 1;  
				// Add this bit to the result. 
				result = (lsb == 1 ? "1" : "0") + result;  
				// Shift numberToConvert right by one bit, to see next bit.  
				numberToConvert >>= 1;  
			}  
			return result;  
		}
	}
}